<%@ page language="java" import="java.util.*" pageEncoding="utf-8"%>
<%
	String flag = (String) request.getAttribute("flag");
	//String actionUrl = "policyMaster/add.do";
	String actionUrl = "";
	String content = "添加保单";
	String buttonText = "保存";
	String fuc = "save()";
	if ("edit".equals(flag)) {
		actionUrl = "policyMaster/edit.do";
		content = "编辑保单";
		buttonText = "更新";
		fuc = "update()";
	} else if ("detail".equals(flag)) {
		actionUrl = "";
		content = "查看保单";
		buttonText = "返回";
		fuc = "go_back()";
	}
%>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<%@include file="/public/head.jspf"%>
<!-- 新 Bootstrap 核心 CSS 文件 -->
<link rel="stylesheet" href="${dailySupport}/css/bootstrap.min.css">
<!-- jQuery文件。务必在bootstrap.min.js 之前引入 -->
<script src="${dailySupport}/js/jquery.min.js"></script>
<!-- 最新的 Bootstrap 核心 JavaScript 文件 -->
<script src="${dailySupport}/js/bootstrap.min.js"></script>
<link rel="stylesheet"
	href="${dailySupport}/js/bootstrap-datetimepicker/build/css/bootstrap-datetimepicker.min.css"></link>
<link rel="stylesheet"
	href="${dailySupport}/css/com/sunny/core/policy/policy_master_crud.css"></link>
<!-- 先加载moment-with-locales.min.js ，后加载datetimepicker.min.js -->
<script src="${dailySupport}/js/moment/min/moment-with-locales.min.js"></script>
<script
	src="${dailySupport}/js/bootstrap-datetimepicker/build/js/bootstrap-datetimepicker.min.js"></script>
<script
	src="${dailySupport}/js/bootstrap_validator/bootstrapValidator.js"></script>
<script
	src="${dailySupport}/js/com/sunny/core/policy/policy_master_crud.js"></script>

</head>

<body>
	<div style="padding:0px; margin:0px;">
		<ul class="breadcrumb" style="  margin:0px; ">
			<li><a href="#">系统管理</a></li>
			<li>保单管理</li>
			<li><%=content%></li>

		</ul>
	</div>

	<form id="policyMasterForm" action="${dailySupport}/<%=actionUrl%>"
		class="form-horizontal" method="post" onkeydown="if(event.keyCode==13)return false;"> 
	
		<h5 class="page-header alert-info"
			style="padding:10px; margin:0px; margin-bottom:5px;">基本信息</h5>
		<div class="row">
			<div class="col-sm-4">
				<div class="form-group">
					<label class="col-sm-5 control-label">保单号</label>
					<div class="col-sm-6">
						<input type="text" name="policyCode" class="form-control input-sm"
							<%if (!"detail".equals(flag)){%> placeholder="" <%}else{ %>
							readonly="true" <%}%> value="${policyMaster.policyCode}" />
					</div>
				</div>

			</div>
			<div class="col-sm-4">
				<div class="form-group">
					<label class="col-sm-5 control-label">生效日期</label>
					<div class="col-sm-6">
						<input type="text" name="effectiveDate"
							class="form-control input-sm" <%if (!"detail".equals(flag)){%>
							placeholder="" <%}else{ %> readonly="true" <%}%>
							value="${policyMaster.effectiveDate}" />
					</div>
				</div>
			</div>
			<div class="col-sm-4">
				<div class="form-group">
					<label class="col-sm-5 control-label">应交日</label>
					<div class="col-sm-7">
						<input type="text" name="payableDate"
							class="form-control input-sm" <%if (!"detail".equals(flag)){%>
							placeholder="" <%}else{ %> readonly="true" <%}%>
							value="${policyMaster.payableDate}" />
					</div>
				</div>
			</div>
		</div>
		<div class="row">
			<div class="col-sm-4">
				<div class="form-group">
					<label class="col-sm-5 control-label">交费期间</label>
					<div class="col-sm-6">
						<input type="text" name="paymentPeriod" class="form-control input-sm"
							<%if (!"detail".equals(flag)){%> placeholder="" <%}else{ %>
							readonly="true" <%}%> value="${policyMaster.paymentPeriod}" />
					</div>
				</div>

			</div>
			<div class="col-sm-4">
				<div class="form-group">
					<label class="col-sm-5 control-label">保险期间</label>
					<div class="col-sm-6">
						<input type="text" name="insurancePeriod" class="form-control input-sm"
							<%if (!"detail".equals(flag)){%> placeholder="" <%}else{ %>
							readonly="true" <%}%> value="${policyMaster.insurancePeriod}" />
					</div>
				</div>
			</div>
			<div class="col-sm-4">
				<div class="form-group">
					<label class="col-sm-5 control-label">投保人姓名</label>
					<div class="col-sm-7">
						<input type="text" name="holderName" class="form-control input-sm"
							<%if (!"detail".equals(flag)){%> placeholder="" <%}else{ %>
							readonly="true" <%}%> value="${policyMaster.holderName}" />
					</div>
				</div>
			</div>
		</div>
		<div class="row">
			<div class="col-sm-4">
				<div class="form-group">
					<label class="col-sm-5 control-label">被保人姓名</label>
					<div class="col-sm-6">
						<input type="text" name="insuredName" class="form-control input-sm"
							<%if (!"detail".equals(flag)){%> placeholder="" <%}else{ %>
							readonly="true" <%}%> value="${policyMaster.insuredName}" />
					</div>
				</div>

			</div>
			<div class="col-sm-4">
				<div class="form-group">
					<label class="col-sm-5 control-label">通讯地址</label>
					<div class="col-sm-6">
						<input type="text" name="postalAddress" class="form-control input-sm"
							<%if (!"detail".equals(flag)){%> placeholder="" <%}else{ %>
							readonly="true" <%}%> value="${policyMaster.postalAddress}" />
					</div>
				</div>
			</div>
			<div class="col-sm-4">
				<div class="form-group">
					<label class="col-sm-5 control-label">投保人手机</label>
					<div class="col-sm-7">
						<input type="text" name="holderPhoneNum" class="form-control input-sm"
							<%if (!"detail".equals(flag)){%> placeholder="" <%}else{ %>
							readonly="true" <%}%> value="${policyMaster.holderPhoneNum}" />
					</div>
				</div>
			</div>
		</div>
		<div class="row">
			<div class="col-sm-4">
				<div class="form-group">
					<label class="col-sm-5 control-label">投保人家庭电话</label>
					<div class="col-sm-6">
						<input type="text" name="holderHomePhoneNum" class="form-control input-sm"
							<%if (!"detail".equals(flag)){%> placeholder="" <%}else{ %>
							readonly="true" <%}%> value="${policyMaster.holderHomePhoneNum}" />
					</div>
				</div>

			</div>
			<div class="col-sm-4">
				<div class="form-group">
					<label class="col-sm-5 control-label">业务员姓名</label>
					<div class="col-sm-6">
						<input type="text" name="agentName" class="form-control input-sm"
							<%if (!"detail".equals(flag)){%> placeholder="" <%}else{ %>
							readonly="true" <%}%> value="${policyMaster.agentName}" />
					</div>
				</div>
			</div>
			<div class="col-sm-4">
				<div class="form-group">
					<label class="col-sm-5 control-label">业务员电话</label>
					<div class="col-sm-7">
						<input type="text" name="agentPhoneNum" class="form-control input-sm"
							<%if (!"detail".equals(flag)){%> placeholder="" <%}else{ %>
							readonly="true" <%}%> value="${policyMaster.agentPhoneNum}" />
					</div>
				</div>
			</div>
		</div>
		<div class="row">
			<div class="col-sm-4">
				<div class="form-group">
					<label class="col-sm-5 control-label">险种名称</label>
					<div class="col-sm-6">
<%-- 						<input type="text" name="insuranceName"
							class="form-control input-sm" <%if (!"detail".equals(flag)){%>
							placeholder="" <%}else{ %> readonly="true" <%}%>
							value="${policyMaster.insuranceName}" /> --%>
							<sunny_html:dictionary type="XZMC" name="insuranceName"/>
					</div>
				</div>

			</div>
			<div class="col-sm-4">
				<div class="form-group">
					<label class="col-sm-5 control-label">应缴保费</label>
					<div class="col-sm-6">
						<input type="text" name="premiumPayable" class="form-control input-sm"
							<%if (!"detail".equals(flag)){%> placeholder="" <%}else{ %>
							readonly="true" <%}%> value="${policyMaster.premiumPayable}" />
					</div>
				</div>
			</div>
			<div class="col-sm-4">
				<div class="form-group">
					<label class="col-sm-5 control-label">缴费方式</label>
					<div class="col-sm-7">
						<input type="text" name="paymentMethod" class="form-control input-sm"
							<%if (!"detail".equals(flag)){%> placeholder="" <%}else{ %>
							readonly="true" <%}%> value="${policyMaster.paymentMethod}" />
					</div>
				</div>
			</div>
		</div>
		<div class="row">
			<div class="col-sm-4">
				<div class="form-group">
					<label class="col-sm-5 control-label">开户银行</label>
					<div class="col-sm-6">
						<input type="text" name="oppeningBank" class="form-control input-sm"
							<%if (!"detail".equals(flag)){%> placeholder="" <%}else{ %>
							readonly="true" <%}%> value="${policyMaster.oppeningBank}" />
					</div>
				</div>

			</div>
			<div class="col-sm-4">
				<div class="form-group">
					<label class="col-sm-5 control-label">开户账号</label>
					<div class="col-sm-6">
						<input type="text" name="accountNum" class="form-control input-sm"
							<%if (!"detail".equals(flag)){%> placeholder="" <%}else{ %>
							readonly="true" <%}%> value="${policyMaster.accountNum}" />
					</div>
				</div>
			</div>
			<div class="col-sm-4">
				<div class="form-group">
					<label class="col-sm-5 control-label">保单状态</label>
					<div class="col-sm-7">
						<input type="text" name="policyStatus" class="form-control input-sm"
							<%if (!"detail".equals(flag)){%> placeholder="" <%}else{ %>
							readonly="true" <%}%> value="${policyMaster.policyStatus}" />
					</div>
				</div>
			</div>
		</div>
		<div class="row">
			<div class="col-sm-4">
				<div class="form-group">
					<label class="col-sm-5 control-label">缴次</label>
					<div class="col-sm-6">
						<input type="text" name="paymentTimes" class="form-control input-sm"
							<%if (!"detail".equals(flag)){%> placeholder="" <%}else{ %>
							readonly="true" <%}%> value="${policyMaster.paymentTimes}" />
					</div>
				</div>
			</div>
			<div class="col-sm-4">
				<div class="form-group">
					<label class="col-sm-5 control-label">保险公司名称</label>
					<div class="col-sm-7">
						<input type="text" name="orgCode" class="form-control input-sm"
							<%if (!"detail".equals(flag)){%> placeholder="" <%}else{ %>
							readonly="true" <%}%> value="${policyMaster.orgCode}" />
					</div>
				</div>
			</div>
		<%if ("detail".equals(flag)){%> 
			<div class="col-sm-4">
				<div class="form-group">
					<label class="col-sm-5 control-label">添加时间</label>
					<div class="col-sm-6">
						<input type="text" name="createTime" class="form-control input-sm"
							<%if (!"detail".equals(flag)){%> placeholder="" <%}else{ %>
							readonly="true" <%}%> value="${policyMaster.createTime}" />
					</div>
				</div>
			</div>
		</div>
		<div class="row">
			<div class="col-sm-4">
				<div class="form-group">
					<label class="col-sm-5 control-label">添加人</label>
					<div class="col-sm-7">
						<input type="text" name="createUsername" class="form-control input-sm"
							<%if (!"detail".equals(flag)){%> placeholder="" <%}else{ %>
							readonly="true" <%}%> value="${policyMaster.createUsername}" />
					</div>
				</div>
			</div>		
			<div class="col-sm-4">
				<div class="form-group">
					<label class="col-sm-5 control-label">修改时间</label>
					<div class="col-sm-6">
						<input type="text" name="updateTime" class="form-control input-sm"
							<%if (!"detail".equals(flag)){%> placeholder="" <%}else{ %>
							readonly="true" <%}%> value="${policyMaster.updateTime}" />
					</div>
				</div>

			</div>
			<div class="col-sm-4">
				<div class="form-group">
					<label class="col-sm-5 control-label">修改人</label>
					<div class="col-sm-6">
						<input type="text" name="updateUsername" class="form-control input-sm"
							<%if (!"detail".equals(flag)){%> placeholder="" <%}else{ %>
							readonly="true" <%}%> value="${policyMaster.updateUsername}" />
					</div>
				</div>
			</div>
		</div>
		<%} else {%>
		</div>
		<% } %> 
		
		<input type="hidden" name="policyMasterPid" value="${policyMaster.policyMasterPid}" />
		<h5 class="page-header alert-info"
			style="padding:10px; margin:0px; margin-bottom:5px;">
			主副险详细信息
			<%
			if (!"detail".equals(flag)) {
		%><input type="button"
				onclick="toPolicyInfoCrud()" class="btn  btn-success pull-right"
				style="padding:1px 1px" value="添加主副险种信息" />
			<%
				}
			%>
		</h5>
		<div class="row" style="padding: 15px; padding-top: 0px;">
			<table class="table  table-condensed table-striped">
				<tr>
					<th>序号</th>
					<th>交费期间</th>
					<th>保险期间</th>
					<th>险种名称</th>
					<th>应缴保费</th>
					<th>操作</th>
				</tr>
				<c:forEach items="${policyInfoList}" var="s" varStatus="status">
					<c:if test="${s.policyInfoPid != '' && s.policyInfoPid != null}">
					<tr>
						<td>${(pageNum-1)*pageSize + status.index + 1}</td>
						<td>${s.paymentPeriod}</td>
						<td>${s.insurancePeriod}</td>
						<td>${s.insuranceName}</td>
						<td>${s.premiumPayable}</td>
						<td>
							<% if (!"detail".equals(flag)) { %> <a
							href="${dailySupport}/policyInfo/toEdit.do?policyInfoPid=${s.policyInfoPid}">修改</a>
							<a href="javascript:deletePolicyInfo('${s.policyInfoPid}')">删除</a>
							<% } else {%>
							<a href="${dailySupport}/policyInfo/toDetail.do?policyInfoPid=${s.policyInfoPid}">查看详细信息</a>
							<% } %>
							</td>
					</tr>
					</c:if>
				</c:forEach>
			</table>
		</div>
		<div class="row">
			<div class="col-sm-5 col-sm-offset-4">
				<input type="button" class="btn btn-success" value="<%=buttonText%>"
					onclick="<%=fuc%>" />
				<%
					if (!("detail".equals(flag))) {
				%>
				<input type="reset" class="btn  btn-danger" value="重置" />
				<input type="button" class="btn btn-warning" value="返回" onclick="javascript:window.history.go(-1)"/>				
				<%
					}
				%>
			</div>
		</div>
	</form>

</body>
</html>
